package com.hdax.gulimall.member.webController;


import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hdax.common.utils.R;
import com.hdax.gulimall.member.feign.OrderFeignService;
import org.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.net.http.HttpRequest;
import java.util.HashMap;
import java.util.Map;

@Controller
public class MemberWebController {


    @Autowired
    private OrderFeignService orderFeignService;

    @Autowired
    private ObjectMapper objectMapper;


    /**
     * 支付完成跳转订单详情
     * @param pageNum
     * @param model
     * @return
     * @throws JsonProcessingException
     */
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum, Model model) throws JsonProcessingException {
        Map<String,Object> map=new HashMap<>();
        map.put("page",pageNum.toString());
        R r = orderFeignService.listWithItem(map);
        model.addAttribute("orders",r);
        return "orderList";
    }
}
